//package org.example.spirngmvcdemo;
//
//import com.fasterxml.jackson.core.JsonProcessingException;
//import com.fasterxml.jackson.databind.ObjectMapper;
//
//public class JSONUtil {
//    public static void main(String[] args) throws JsonProcessingException {
//        ObjectMapper objectMapper = new ObjectMapper();
//        UserInfo userInfo =  new UserInfo();
//        userInfo.setId(1);
//        userInfo.setName("zhangsan");
//        userInfo.setAge(19);
//
//        // Java 对象 转 json 字符串
//        String jsonResp = objectMapper.writeValueAsString(userInfo);
//        System.out.println(jsonResp);
//
//        // json 字符串 转 Java 对象
//        UserInfo userInfo1 = objectMapper.readValue(jsonResp, UserInfo.class);
//        System.out.println(userInfo1);
//    }
//}
